package fiscal.entities.tables;

import java.util.ArrayList;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

import exceptions.PersistenceExceptionMessage;
import fiscal.dao.PersistenceTipoInventario;
import generic.interfaces.GenericPersistence;
import generic.interfaces.IDEntity;

@Entity
public class TipoInventario implements IDEntity<String>, GenericPersistence<PersistenceTipoInventario, String, TipoInventario>{

	public static PersistenceTipoInventario persist = new PersistenceTipoInventario();
	
	@Id
	@Column(length=3)
	private String id;
	@Column(length=60)
	private String descricao;
	
	
	public PersistenceTipoInventario DAOInstance() {
		if (persist == null) {
			persist = new PersistenceTipoInventario();
		}
		return persist;
	}

	
	public TipoInventario find(String id) throws PersistenceExceptionMessage {
		return DAOInstance().find(id);
	}

	
	public void persist() throws PersistenceExceptionMessage {
		DAOInstance().persist(this);
	}

	
	public void remove() throws PersistenceExceptionMessage {
		DAOInstance().remove(this);
	}

	
	public TipoInventario merge() throws PersistenceExceptionMessage {
		return DAOInstance().merge(this);
	}

	
	public ArrayList<TipoInventario> findAll() throws PersistenceExceptionMessage {
		return (ArrayList<TipoInventario>) DAOInstance().findAll();
	}

	
	public void setId(String id) {
		this.id = id;
	}

	
	public String getId() {
		return this.id;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}
	
	public String toString() {
		if (id == null) 
			return getDescricao();
		return getId() +" - " +getDescricao();
	}
	
}
